Like Java, Kotlin offers enum support, to provide symbols to a related set of states. In the case of Kotlin, enum specifically is a type of class — you use enum class to declare one.

Since an enum is a class, it supports many ordinary features of classes, such as constructors with properties. This is very useful for mapping external definitions to type-safe symbols, such as mapping HTTP response codes to symbols, as we are doing here.

You can learn more about this in:
Run Edit